package com.shiguiwu.springmybatis.designpattern.adapter.scene;

import cn.hutool.json.JSONUtil;
import com.shiguiwu.springmybatis.designpattern.adapter.scene.mq.create_account;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @description: 适配器模式，场景是mq,不同的字段，统一接受
 * @author: stone
 * @date: Created by 2021/8/19 10:46
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.adapter.scene
 */
@Slf4j
public class SceneTests {

    public static void main(String[] args) {
        create_account create_account = new create_account();
        create_account.setAccountDate(new Date());
        create_account.setAddress("江华瑶族自治县");
        create_account.setDesc("江华瑶族自治县");
        create_account.setNumber("18676894410");

        Map<String, String> config = new HashMap<>();
        config.put("userId", "number");
        config.put("bizId", "number");
        config.put("bizTime", "accountDate");
        config.put("desc", "desc");

        RebateInfo filter = MQAdapter.filter(JSONUtil.toJsonStr(create_account), config);

        log.info("修改前： {}", JSONUtil.toJsonStr(create_account));
        log.info("修改后： {}", JSONUtil.toJsonStr(filter));


    }
}
